﻿package mortal.game.view.npc.data
{
    import Message.DB.Tables.*;
    import com.mui.controls.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.view.task.data.*;

    public class NpcTaskAutoDialogData extends Object
    {
        public var taskInfo:TaskInfo;
        public var npcInfo:TNpc;
        public var icon:String = "";
        public var talk:String;
        public var seconds:int;
        public var showSeconds:int;

        public function NpcTaskAutoDialogData()
        {
            return;
        }// end function

        public static function parse(param1:String, param2:TaskInfo) : Array
        {
            var _loc_6:String = null;
            var _loc_7:Array = null;
            var _loc_8:NpcTaskAutoDialogData = null;
            var _loc_3:Array = [];
            if (param1 == null)
            {
                return _loc_3;
            }
            var _loc_4:* = param1.split("&");
            var _loc_5:int = 0;
            while (_loc_5 < _loc_4.length)
            {
                
                _loc_6 = _loc_4[_loc_5];
                _loc_7 = _loc_6.split("#");
                _loc_8 = new NpcTaskAutoDialogData;
                _loc_3.push(_loc_8);
                _loc_8.taskInfo = param2;
                _loc_8.npcInfo = NPCConfig.instance.getInfoByCode(int(_loc_7[0]));
                _loc_8.icon = String(_loc_7[0]);
                _loc_8.talk = _loc_7[1];
                if (_loc_8.talk == null)
                {
                    Alert.show("自动对话的格式为：npc#对话内容#持续时间&npc#对话内容#持续时间, 请查看任务的配置，taskId=" + param2.stask.code);
                }
                _loc_8.seconds = int(_loc_7[2]);
                _loc_8.showSeconds = int(_loc_7[3]);
                _loc_5++;
            }
            return _loc_3;
        }// end function

    }
}
